// 班级路由
const express = require('express');
const router = express.Router();
const ClassController = require('../controllers/classController');
const { authMiddleware, teacherMiddleware } = require('../utils/authMiddleware');

/**
 * 班级路由
 * 定义班级管理相关的API端点
 */

// 获取班级列表（学生也可以查看）
router.get('/', authMiddleware, ClassController.getAllClasses);
router.get('/:classId', authMiddleware, ClassController.getClassById);

// 教师专用路由（管理班级）
router.post('/', authMiddleware, teacherMiddleware, ClassController.createClass);
router.put('/:classId', authMiddleware, teacherMiddleware, ClassController.updateClass);
router.delete('/:classId', authMiddleware, teacherMiddleware, ClassController.deleteClass);

module.exports = router;